package org.example.y24.m10;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int max = 0;
        int min = 100;
        int n = scanner.nextInt();
        while(n > 0){
            int num = scanner.nextInt();
            max = num > max ? num : max;
            min = num > min ? min : num;
            n--;
        }
        System.out.println(max - min);
    }
}
